/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.biblioteca.vo;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Version;

/**
 *
 * @author joaosavio
 */
@Entity
public class Loan implements Serializable {

    @Version
    private int version;

    @EmbeddedId
    private LoanPK loanPK = new LoanPK();

    public Loan() {
    }

    public Loan(User user, Book book) {
        loanPK.setUser(user);
        loanPK.setBook(book);
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public LoanPK getLoanPK() {
        return loanPK;
    }

    public void setLoanPK(LoanPK loanPK) {
        this.loanPK = loanPK;
    }    
}
